Skip to content

Conversation

@Ansonhkg
Copy link
Collaborator

@Ansonhkg Ansonhkg commented Oct 17, 2025

WHAT

  • expose a minimal withLocalContext helper
  • update the e2e init flow to call .withLocalContext when NAGA_LOCAL_CONTEXT_PATH (and optional name) are provided
  • add createShivaClient to @lit-protocol/e2e so QA can control Shiva-managed testnets and assert epoch changes through a Lit client
  • add full payment delegation life cycle e2e test
  • fix maxPrice now is being sent as hex instead of decimal the node deserialises via serde_json into ethers::types::U256, which treats bare strings as hex. Sending our decimal bigint (e.g. "250000000000000000") therefore turns into the much larger 0x2500... amount.
  • (❗️Note) This PR contains a minor changeset

Usage

import { createLitClient } from '@lit-protocol/lit-client';
import { nagaLocal } from '@lit-protocol/networks';
import { createShivaClient } from '@lit-protocol/e2e';

const network = nagaLocal.withLocalContext({
  networkContextPath: './lit-assets/blockchain/contracts/networkContext.json',
  networkName: 'naga-develop', // optional
});
const client = await createLitClient({ network });

const shiva = await createShivaClient(client, { baseUrl: 'http://localhost:8000' });
const before = await shiva.inspectEpoch();

// trigger epoch via Shiva and wait until the Lit client sees the rollover
await shiva.transitionEpochAndWait();

const after = await shiva.waitForEpochChange({ baselineEpoch: before.epoch });

Shiva APIs

  • inspectEpoch() - snapshot the Lit client context (chain epoch, per-node epochs, threshold, connected count, latest blockhash).
  • waitForEpochChange({ baselineEpoch, timeoutMs?, intervalMs? }) - poll until the epoch advances beyond the baseline (defaults: 60s timeout, 2s interval).
  • transitionEpochAndWait() - trigger /test/action/transition/epoch/wait/<id> to advance the epoch and wait for completion.
  • stopRandomNodeAndWait() - invoke /test/action/stop/random/wait/<id> to drop a random node and wait for the next epoch.
  • pollTestnetState() - fetch /test/poll/testnet/<id> for the current Shiva state (Busy, Active, etc.).
  • getTestnetInfo() - return /test/get/info/testnet/<id> payload (contracts, RPC URL, epoch config).
  • deleteTestnet() - call /test/delete/testnet/<id> to shut down the managed testnet.
  • baseUrl / testnetId – exposed properties for logging and reuse.

Snapshots published

🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]

Test

Created a QA starter kit for this:
https://github.com/LIT-Protocol/QA-kit

Copilot AI review requested due to automatic review settings October 17, 2025 22:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds local configuration support for the Naga network by introducing a withLocalContext helper method that allows loading custom network signatures from local JSON files.

  • Exposed a minimal withLocalContext helper that accepts network context configuration options
  • Updated the e2e initialization to conditionally use withLocalContext when NAGA_LOCAL_CONTEXT_PATH environment variable is available
  • Refactored the naga-local module to support dynamic signature loading and configuration overrides

Reviewed Changes

Copilot reviewed 8 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/wasm/package.json Updated build scripts to use pnpm instead of yarn
packages/networks/src/networks/vNaga/index.ts Added export for NagaLocalContextOptions type
packages/networks/src/networks/vNaga/envs/naga-local/naga-local.module.ts Major refactor to support dynamic configuration with withLocalContext method
packages/networks/src/networks/vNaga/envs/naga-local/naga-local.env.ts Updated constructor to accept custom signatures parameter
packages/networks/src/networks/vNaga/envs/naga-local/index.ts Added export for new types
packages/e2e/src/init.ts Added conditional logic to use withLocalContext when environment variables are set
packages/contracts/src/custom-network-signatures.ts Extracted buildSignaturesFromContext function for runtime signature building

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Ansonhkg Ansonhkg self-assigned this Oct 18, 2025
@Ansonhkg
Copy link
Collaborator Author

Snapshots published

🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]
🦋  New tag:  @lit-protocol/[email protected]

@GTC6244

…s-132-naga-test-allow-naga-local-configuration
@Ansonhkg Ansonhkg merged commit 50f79b6 into naga Oct 30, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants